#region [file: RepasseAoClienteDAL.cs, author: CelesteMGB]
// File:    RepasseAoClienteDAL.cs
// Author:  CelesteMGB
// Created: domingo, 26 de fevereiro de 2012 14:03:00
// Purpose: Defines dao implementation class for class RepasseAoCliente
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using NHibernate.Criterion;
using DA_OOMModel;
using DA_OOMModelIDAL;

namespace DA_OOMNHibernateDAL
{
   /// <summary>
   /// Class that implements methods of IRepasseAoClienteDAL interface
   /// </summary>
   public class RepasseAoClienteDAL : NHibernateDALBase,  IRepasseAoClienteDAL 
   {
      #region CRUD methods
      /// <summary>
      /// Get all instances of RepasseAoCliente
      /// </summary>     
      public List<RepasseAoCliente> GetRepasseAoClienteList()
      {
         return ConvertToGenericList(base.LoadAll(typeof(RepasseAoCliente)));
      }
      
      /// <summary>
      /// Get the instances of RepasseAoCliente from index firstResult to index maxResult
      /// </summary>
      public List<RepasseAoCliente> GetRepasseAoClienteList(int firstResult, int maxResult)
      {
         return ConvertToGenericList(base.LoadAll(typeof(RepasseAoCliente), firstResult, maxResult));
      }

      /// <summary>
      /// Load the instance of RepasseAoCliente according its primary key instance.
      /// </summary>
      public RepasseAoCliente Load(RepasseAoClientePK repasseAoClientePK)
      {
         IList cs = new ArrayList();
         string[] paramNames = new string[] { "RecIdRepasseCliente" };
         object[] values = new object[] { repasseAoClientePK.RecIdRepasseCliente };
         for (int i = 0; i < paramNames.Length; i++)
             cs.Add(Expression.Eq(paramNames[i], values[i]));

         IList list = base.FindByCriterions(typeof(RepasseAoCliente), cs);
         return (((list != null) && (list.Count > 0)) ? (RepasseAoCliente)list[0] : null);
      }

      /// <summary>
      /// Query the instances of RepasseAoCliente according its example instance.
      /// </summary>
      public List<RepasseAoCliente> QueryByExample(RepasseAoCliente repasseAoCliente)
      {
         return ConvertToGenericList(base.QueryByExample(typeof(RepasseAoCliente), repasseAoCliente));
      }

      /// <summary>
      /// Query the instances of RepasseAoCliente according its example instance from index firstResult to index maxResult
      /// </summary>
      public List<RepasseAoCliente> QueryByExample(RepasseAoCliente repasseAoCliente, int firstResult, int maxResult)
      {
         return ConvertToGenericList(base.QueryByExample(typeof(RepasseAoCliente), repasseAoCliente, firstResult, maxResult));
      }
      
      /// <summary>
      /// Insert the instances of RepasseAoCliente
      /// </summary>
      public void Insert(RepasseAoCliente repasseAoClienteObject)
      {
         base.Save(repasseAoClienteObject);
      }
      
      /// <summary>
      /// Update the instances of RepasseAoCliente
      /// </summary>
      public void Update(RepasseAoCliente repasseAoClienteObject)
      {
         base.Update(repasseAoClienteObject);
      }
      
      /// <summary>
      /// Delete the instances of RepasseAoCliente
      /// </summary>
      public void Delete(RepasseAoCliente repasseAoClienteObject)
      {
         base.Delete(repasseAoClienteObject);
      }
      #endregion
      
   
      
      /// <summary>
      /// Find <Code>RepasseAoCliente</Code> instances by MovimentacaoFinanceira
      /// </summary>
      /// <param name="movimentacaoFinanceira"/>
      /// <returns>RepasseAoCliente instance list</returns>
      public List<RepasseAoCliente> FindByMovimentacaoFinanceira(MovimentacaoFinanceira movimentacaoFinanceira)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("MovimentacaoFinanceira", movimentacaoFinanceira));
         return ConvertToGenericList(base.FindByCriterions(typeof(MovimentacaoFinanceira), cs));
      }
      
      /// <summary>
      /// Find <Code>RepasseAoCliente</Code> instances  instances in range firstResult, maxResult by MovimentacaoFinanceira
      /// </summary>
      /// <param name="movimentacaoFinanceira"/>
      /// <param name="firstResult">first result to return</param>
      /// <param name="maxResult">max result to return</param>
      /// <returns>RepasseAoCliente instance list</returns>
      public List<RepasseAoCliente> FindByMovimentacaoFinanceira(MovimentacaoFinanceira movimentacaoFinanceira, int firstResult, int maxResult)
      {
         IList cs = new ArrayList();
         cs.Add(Expression.Eq("MovimentacaoFinanceira", movimentacaoFinanceira));
         return ConvertToGenericList(base.FindByCriterions(typeof(MovimentacaoFinanceira), cs, firstResult, maxResult));
      }

      /// <summary>
      /// Convert the IList to the generic List instance.
      /// </summary>
      private List<RepasseAoCliente> ConvertToGenericList(IList repasseAoClientes)
      {
         List<RepasseAoCliente> repasseAoClienteList = new List<RepasseAoCliente>();
         foreach (RepasseAoCliente repasseAoCliente in repasseAoClientes)
         {
             repasseAoClienteList.Add(repasseAoCliente);
         }
         return repasseAoClienteList;
      }      
   }
}